<template>
    <div class="app-container">
        <div class="block">
            <el-row>
                <el-col :span="24">
                    <el-select style="max-width:300px;margin-left: 10px;padding: 0px 15px;font-size: 12px;border-radius: 3px;" v-model="goodsCreatSelect" filterable placeholder="请选择" v-permission="['/writeOff/select']">
                        <el-option v-for="item in goodsCreatList" :key="item.value" :label="item.nameAndAccount" :value="item.id"></el-option>
                    </el-select>
                    <el-date-picker v-model="timeChange" size="mini" type="datetimerange" range-separator="至" start-placeholder="发送起始日期" end-placeholder="发送截至日期" value-format="timestamp" align="right">
                    </el-date-picker>
                </el-col>
            </el-row>
        </div>
        <el-table :data="list" v-loading="listLoading" element-loading-text="Loading" border fit highlight-current-row>
            <el-table-column label="商品名称">
                <template slot-scope="scope">{{ scope.row.goodsName }}</template>
            </el-table-column>
            <el-table-column label="货主" :formatter="formatCreat">
            </el-table-column>
            <el-table-column label="数量">
                <template slot-scope="scope">{{ scope.row.count }}</template>
            </el-table-column>
            <el-table-column label="销售单价(￥)">
                <template slot-scope="scope">{{ fmoney(scope.row.totalPrice/100,2) }}</template>
            </el-table-column>
            <el-table-column label="销售总价(￥)">
                <template slot-scope="scope">{{ fmoney(scope.row.totalPrice/100,2) }}</template>
            </el-table-column>
            <el-table-column label="核算比例">
                <template slot-scope="scope">{{ fmoney(scope.row.writeOffRate,2) }}%</template>
            </el-table-column>
            <el-table-column label="核算单价(￥)">
                <template slot-scope="scope">{{ fmoney(scope.row.price*scope.row.writeOffRate/10000,2) }}</template>
            </el-table-column>
            <el-table-column label="核算总价(￥)">
                <template slot-scope="scope">{{ fmoney(scope.row.totalPrice*scope.row.writeOffRate/10000,2) }}</template>
            </el-table-column>
            <el-table-column label="核销时间" width="160">
                <template slot-scope="scope">{{ scope.row.writeOffTime }}</template>
            </el-table-column>
        </el-table>
        <el-pagination background layout="total, sizes, prev, pager, next, jumper" :page-sizes="[10, 20, 50, 100,500]" :page-size="listQuery.limit" :total="total" :current-page.sync="listQuery.page" @size-change="changeSize" @current-change="fetchPage" @prev-click="fetchPrev" @next-click="fetchNext"></el-pagination>
    </div>
</template>

<script src="./writeOff.js"></script>


<style rel="stylesheet/scss" lang="scss" scoped>
@import "src/styles/common.scss";
</style>

